package com.hc.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hc.domain.Country;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author hecai
 */
@Mapper
public interface CountryMapper extends BaseMapper<Country> {

    @Select("SELECT CONCAT(tb_province.`name`,'-',tb_city.`name`,'-', tb_country.`name`)\n" +
            "FROM  tb_province  INNER JOIN  tb_city \n" +
            "ON \ttb_province.id = tb_city.province_id\n" +
            "INNER JOIN tb_country\n" +
            "ON tb_city.id = tb_country.city_id\n" +
            "WHERE tb_country.id = #{id} ")
    String selectProvinceCityCountryByCountryId(@Param("id") Integer countryId);
}